package com.lc.controller;

import com.lc.entity.Food;
import com.lc.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Author:LC
 * Version:jdk-8u301
 * Date: 2022/7/4 16:35
 */
@RestController
public class FoodController {

    @Autowired
    private FoodService foodService;

    @GetMapping("/getFoodById/{id}")
    public Food getFoodById(@PathVariable Integer id){
        return foodService.findFoodById(id);
    }


    @GetMapping("/modifyFood")
    public Object modifyFood(Food food){
        int i = foodService.modifyFoodData(food);
        return getFoodById(food.getId());
    }
}
